using System;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;


namespace Discuz.Data.SqlServer
{
    public partial class DataProvider : IDataProvider
    {

        public DataView GetTYUserCodeBy(string deptid, string corpid)
        {
            //string sql = "SELECT UserCode FROM Sys_User  WHERE 1=1";
            //if (!string.IsNullOrEmpty(deptid) && deptid != "0")
            //{
            //    sql += string.Format(" AND DeptCode='{0}'", deptid);
            //}
            //if (!string.IsNullOrEmpty(corpid) && corpid != "0")
            //{
            //    sql += string.Format(" AND CorpCode='{0}'", corpid);
            //}
            //Frame.Data d = new Frame.Data();
            //return d.DataView(sql);
            return null;
       }
        public DataView GetTYUser(string userCode)
        {
            Frame.Power p = new Frame.Power();
            DataView dw = p.getPsnList(userCode);
            if (dw.Count > 0)
            {
                DataRowView dr = dw[0];
                dr[5] = GetCode1ToCode2(dr[5].ToString());
                dr[2] = GetCode1ToCode2(dr[2].ToString());
            }
            return dw;
        }
        public string GetTYUserNameByUserCode(string code)
        {
            Frame.Power p = new Frame.Power();
            return p.getPsnName(code);
            
        }
        public string GetCode1ToCode2(string code1)
        {
            Frame.BO bo = new Frame.BO();
            string boDept = bo.getBoCodeFromDept("HH",code1);
            return boDept.Substring(0,4);
            
        }
        public DataView GetTYDept()
        {
            Frame.BO bo = new Frame.BO();
            DataView dv = bo.getBoDept("UUFAAA_01", "HH");
            return dv;
        }
        public DataView GetTYCorp()
        {
            Frame.BO bo = new Frame.BO();
            return bo.getBoCorp("UUFAAA_01", "HH");
        }
    }
}
